package Operation;

import Book.Book;
import Book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * user:likai
 * Date:2022-09-30
 * Time:11:16
 */
public class AddOperation implements IOperation{
    @Override
    public void ioperation(BookList bookList) {
        System.out.println("增加图书");
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入书名：");
        String name =scanner.nextLine();
        System.out.println("请输入作者：");
        String author =scanner.nextLine();
        System.out.println("请输入类型：");
        String type=scanner.nextLine();
        System.out.println("请输入价格：");
        int price=scanner.nextInt();
        int curSize= bookList.getUseSize();
        Book book=new Book(name,price,author,type);
        bookList.setBooks(book,curSize);
        bookList.setUseSize(curSize+1);
    }
}
